#include <iostream>
#include <QTest>

#include <QDebug>
#include <sstream>

class UtilsTest : public QObject {
	Q_OBJECT
private:
	private slots:
		void initTestCase() {
			// Called before all unit tests.

			// Initialize the logging engines
			QxtLoggerEngine *fileLogger = new QxtBasicFileLoggerEngine("test.log");
			QxtLoggerEngine *stdoutLogger = new QxtBasicSTDLoggerEngine();

			qxtLog->addLoggerEngine("file", fileLogger);
			qxtLog->addLoggerEngine("stdout", stdoutLogger);

			qxtLog->disableAllLogLevels();

			qxtLog->enableLogLevels("file", QxtLogger::AllLevels);
			qxtLog->enableLogLevels("stdout", QxtLogger::AllLevels);
		}
		void cleanupTestCase() {
			// Called after all tests are run.
			_getch();
		}
		void init() {
			// Called just before any unit test.
		}
		void cleanup() {
			// Called just after any unit test.
		}

		// Unit Test START

		void testUUIDGeneration() {
			std::string uuid = Utils::generateUUID();
			QVERIFY(uuid.length() == 32);
		}

		void testDateString() {
			QDateTime localDT = QDateTime::currentDateTime();
			QString *localDateString = Utils::toDateString(localDT);
			QVERIFY(localDateString->contains(QString("+")));
			
			QDateTime *localParsedDT = Utils::fromDateString(*localDateString);
			QVERIFY(*localParsedDT == localDT);

			delete localDateString;
			delete localParsedDT;
		}

		// Unit Test END
};

//QTEST_MAIN(ControllerTest)
//QTEST_MAIN(GCalManagerTest)
QTEST_MAIN(UtilsTest)
//QTEST_MAIN(ExhaustiveTest)
//QTEST_MAIN(CommandTest)
//QTEST_MAIN(EntryManagerTest)
//QTEST_MAIN(MiscellanousTest);
//QTEST_MAIN(ParserTest)
#include "NotchTest.moc"